-
-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for partial JSON matching #539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
You also need to add this new matcher to
https://github.com/WireMock-Net/WireMock.Net/blob/c02dbeb5eea5fd01ce657e8ec362fd2dddcc5b19/src/WireMock.Net/Serialization/MatcherMapper.cs
And if possible also add an unit-test for that.
Thanks @StefH ! Added changes as suggested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more small things, can you please take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please exlain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Current JsonMatcher only support exact match (via JToken.DeepEquals).
This PR introduces new JsonPartialMatcher, which tolerates input properties, not existing on the Matcher value.
Example:
Matcher value {"test": "abc"} against input {"test":"abc"} is matched by both JsonMatcher and JsonPartialMatcher
Matcher value {"test":"abc"} against input {"test":"abc","other":"xyz"} is not matched by JsonMatcher, but is matched by JsonPartialMatcher
One side benefit of this PR is that JsonMatcher (and JsonPartialMatcher) are now extensible via virtual AreEqual(JToken, JToken) method.